<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>考试第五题</title>
</head>

<body>

</body>
<script>
    /* 
       小明家里有三个人，爸爸和妈妈，
       小明是男的，今年18岁，兴趣爱好是打篮球和读书，
       爸爸是软件程序员，
       妈妈是UI设计师，
       小明家在深圳南山有一套100平方的房子，户型是三房一厅，
       今年小明家刚买了一辆特斯拉Model3.
    */

    /* 利用构造函数创建 */
    //小明
    console.log('小明');
    function Xiaoming(sex, age, habby) {
        this.sex = sex;
        this.age = age;
        this.habby = habby;
    }
    let a = new Xiaoming('男', 18, '打篮球和读书');
    console.log(a);
    //爸爸
    console.log('爸爸');
    function Father(profession) {
        this.profession = profession;
    }
    let fat = new Father('软件程序员');
    console.log(fat);
    //妈妈
    console.log('妈妈');
    function mom(profession) {
        this.profession = profession;
    }
    let mommy = new mom('UI设计师');
    console.log(mommy);
    //房子
    console.log('房子');
    function house(address, size, type) {
        this.address = address;
        this.size = size;
        this.type = type;
    }
    let hous = new house('深圳南山区', '100平', '三室一厅');
    console.log(hous);
    //车
    console.log('车');
    function vehicle(model) {
        this.model = model;
    }
    let vehi = new vehicle('特斯拉Model3');
    console.log(vehi);

</script>

</html>